const SERVERURL = 'http://dev.wenyangchou.com/';
const FILESERVER = 'http://dev.wenyangchou.com/myfiles';
const DOWNLOAD = `${FILESERVER}/cloudFile/common/downloadFile?id=`;
const BACKIMG = {
    back: '5bf116ed128d44d498826ead99e11ea6',
    homeOn: '38f6666f02364a679a43f8e6bd6a90b3',
    me: '8013419d2d6f47faa5360736a0a4dcf5',
    home: '4fc814d81ae14107a716664da20bba0e',
    meOn: 'ff5582cd8ffe45f292ab38c2a6b92bdf',
    orderBack: 'b41cc0bb8908405ebb2fb7111bfc342f',
    khsw: '355d0fb192b64173b8a8e080c5ce4320',
    djlj: '6440bd8b69534d069130898632abb680',
    dzlj: 'd03bb3c4a0ea462f96263f6bd7eae876',
    khswlj: 'a750a16906ac44d28aa63d5e628bb66a',
    ydyh: '98e864417ef44d7bbc183c52f1138721',
};
const APPID = 'wxe95f993d4373000d';
const TENANTCODE = 'TENANT_RDLJFL';
const BUNINESSNUMBER = 'rdljfl';

const config = {
  projectName: 'rd',
  date: '2019-10-10',
  designWidth: 750,
  deviceRatio: {
    '640': 2.34 / 2,
    '750': 1,
    '828': 1.81 / 2
  },
  sourceRoot: 'src',
  outputRoot: 'dist',
  plugins: {
    babel: {
      sourceMap: true,
      presets: [
        ['env', {
          modules: false
        }]
      ],
      plugins: [
        'transform-decorators-legacy',
        'transform-class-properties',
        'transform-object-rest-spread'
      ]
    }
  },
  defineConstants: {
    SERVERURL:  JSON.stringify(SERVERURL),
    FILESERVER: JSON.stringify(FILESERVER),
    DOWNLOAD: JSON.stringify(DOWNLOAD),
    BACKIMG: JSON.stringify(BACKIMG),
    APPID: JSON.stringify(APPID),
    TENANTCODE: JSON.stringify(TENANTCODE),
    BUNINESSNUMBER: JSON.stringify(BUNINESSNUMBER),
  },
  copy: {
    patterns: [
      { from: 'src/images', to: 'dist/images'}
    ],
    options: {
    }
  },
  weapp: {
    module: {
      postcss: {
        autoprefixer: {
          enable: true,
          config: {
            browsers: [
              'last 3 versions',
              'Android >= 4.1',
              'ios >= 8'
            ]
          }
        },
        pxtransform: {
          enable: true,
          config: {

          }
        },
        url: {
          enable: true,
          config: {
            limit: 10240 // 设定转换尺寸上限
          }
        },
        cssModules: {
          enable: false, // 默认为 false，如需使用 css modules 功能，则设为 true
          config: {
            namingPattern: 'module', // 转换模式，取值为 global/module
            generateScopedName: '[name]__[local]___[hash:base64:5]'
          }
        }
      }
    }
  },
  h5: {
    publicPath: '/',
    staticDirectory: 'static',
    module: {
      postcss: {
        autoprefixer: {
          enable: true,
          config: {
            browsers: [
              'last 3 versions',
              'Android >= 4.1',
              'ios >= 8'
            ]
          }
        },
        cssModules: {
          enable: false, // 默认为 false，如需使用 css modules 功能，则设为 true
          config: {
            namingPattern: 'module', // 转换模式，取值为 global/module
            generateScopedName: '[name]__[local]___[hash:base64:5]'
          }
        }
      }
    }
  }
}

module.exports = function (merge) {
  // if (process.env.NODE_ENV === 'development') {
  //   return merge({}, config, require('./dev'))
  // }
  return merge({}, config, require('./prod'))
}
